Content addressable memory (CAM) devices are frequently used in network switching and routing applications to determine forwarding destinations for data packets. A CAM device can be instructed to compare a selected portion of an incoming packet (e.g., a destination address extracted from the packet header) with CAM words (e.g., forwarding addresses) stored in an array within the CAM device. If there is a matching entry stored in the CAM array, the index of the matching CAM word can be used to access a corresponding location in an associated memory device to retrieve a destination address and/or other routing information for the packet.
A CAM device includes a CAM array having a plurality of CAM cells organized in a number of rows and columns. Each row of CAM cells, which can be used to store a CAM word, is coupled to a corresponding match line that indicates match results for the row. Each column of CAM cells is typically coupled to one or more data lines or data line pairs that can be used to drive data into a selected CAM row during write operations, read data from a selected CAM row during read operations, and/or for providing a search key to the CAM rows during compare operations. During a compare operation, the search key (e.g., the comparand word) is provided to the CAM array and compared with the CAM words stored therein. For each CAM word that matches the search key, a corresponding match line is asserted to indicate the match result. If any of the match lines are asserted, a match flag is asserted to indicate the match condition, and a priority encoder determines the match address or index of the highest priority matching entry in the CAM array.
CAM arrays typically include either binary CAM cells that store binary data values (i.e., a logic “1” or a logic “0” value) or ternary CAM cells that store ternary data values (i.e., a logic “1” value, a logic “0” value, or a don't care value). Ternary CAM cells store a data bit and a mask bit. For example, when a mask bit within a ternary CAM cell is inactive (e.g., set to a logic 1 value), the ternary CAM cell operates as a conventional binary CAM cell storing an “unmasked” data bit. Men the mask hit is active (e.g., set to a logic 0 value), the ternary CAM cell stores a “don't care” value, which means that all compare Operations performed on the actively masked ternary CAM cell will result in a cell match condition.
FIG. 1A shows a well-known quaternary CAM cell 100. Quaternary CAM cell 100, which is also referred to as an XY CAM cell, includes two storage cells 120 and 122 coupled to a compare circuit 130. The two data bits X and Y can collectively represent four possible states: “0”, “1”, “don't care”, and a fourth state which may be left unused or may indicate “invalid,” as depicted in FIG. 1B. The logic “0” and “1” states correspond to the logic states represented, for example, by a conventional binary CAM cell. For each of these states, if the comparand data (e.g., provided to CAM cell 100 via complementary comparand lines CL and CLB) matches the data stored in CAM cell 100, compare circuit 130 does not discharge the match line ML, which indicates a match condition. Conversely, if the comparand data does not match the data stored in CAM cell 100, compare circuit 130 discharges ML (e.g., toward ground potential) to indicate the mismatch condition. For the “don't care” state, the logic low values for X and Y maintain respective transistors 132 and 134 in non-conductive states, thereby preventing compare circuit 130 from discharging ML. In this manner, data stored in CAM cell 100 is masked from the compare operation, thereby forcing a match condition for CAM cell 100, regardless of the comparand data. For the “invalid” state, the logic high values for X and Y maintain respective transistors 132 and 134 in conductive states. During a compare operation, one of the complementary comparand data bit pair provided on CL/CLB will be logic high, thereby causing compare circuit 130 to discharge ML to indicate the mismatch state. In this manner, data stored in CAM cell 100 forces a mismatch condition, regardless of the comparand data, and is therefore not normally used.
Note that the XY CAM cell 100 stores a data value as a complimentary bit pair, where the Y bit stores the binary value and the X bit stores the complemented binary value. However, because only three of the four possible states represented by XY CAM cell 100 are used, data storage capacity is not fully utilized. Thus, it would be desirable to utilize all four of the possible quaternary states to maximize data storage density.